
let utils={
    hasVersion(columns){
        if (Array.isArray(columns)){
            columns.forEach(bean=>{
                if (bean.name == 'version'){
                    return true;
                }
            })
        }
        return false;
    },
// 获取当前时间函数
    timeFormate(timeStamp) {
        let year = new Date(timeStamp).getFullYear();
        let month =new Date(timeStamp).getMonth() + 1 < 10? "0" + (new Date(timeStamp).getMonth() + 1): new Date(timeStamp).getMonth() + 1;
        let date =new Date(timeStamp).getDate() < 10? "0" + new Date(timeStamp).getDate(): new Date(timeStamp).getDate();
        let hh =new Date(timeStamp).getHours() < 10? "0" + new Date(timeStamp).getHours(): new Date(timeStamp).getHours();
        let mm =new Date(timeStamp).getMinutes() < 10? "0" + new Date(timeStamp).getMinutes(): new Date(timeStamp).getMinutes();
        // let ss =new Date(timeStamp).getSeconds() < 10? "0" + new Date(timeStamp).getSeconds(): new Date(timeStamp).getSeconds();
        // return year + "年" + month + "月" + date +"日"+" "+hh+":"+mm ;
        // this.nowTime = year + "年" + month + "月" + date +"日"+" "+hh+":"+mm ;
        return  date+"/"+month+"/"+year+" " +hh+":"+mm;
        // console.log(this.nowTime);
    },
    nowTimes() {
        return this.timeFormate(new Date());
    },
    createdHead(){
        return '/**\n' +
            ' * @author liushiyu@changingedu.com\n' +
            ' * @date '+this.timeFormate(new Date())+'\n' +
            ' */'
    },
    downloadFileHelper(fileName, content) {
        const aTag = document.createElement('a');
        const blob = new Blob([content]);

        aTag.download = fileName;
        aTag.style = "display: none";
        aTag.href = URL.createObjectURL(blob);
        document.body.appendChild(aTag);
        aTag.click();

        setTimeout(function () {
            document.body.removeChild(aTag);
            window.URL.revokeObjectURL(blob);
        }, 100);
    }
}

export default utils;